package com.galaxy.device.api;

import com.galaxy.common.core.domain.R;
import com.galaxy.device.config.FeignConfig;
import com.galaxy.device.domain.vo.ProductVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 商品服务接口
 */
@FeignClient(
    contextId = "remoteProductService",
    value = "galaxy-product",
    fallbackFactory = RemoteProductFallbackFactory.class,
    configuration = FeignConfig.class
)
public interface RemoteProductService {

    /**
     * 获取商品信息
     *
     * @param id 商品ID
     * @return 商品信息
     */
    @GetMapping("/product/byId/{id}")
    R<ProductVo> getInfo(@PathVariable("id") Long id);

    /**
     * 批量获取商品信息
     *
     * @param ids 商品ID列表
     * @return 商品信息列表
     */
    @GetMapping("/product/batch")
    R<List<ProductVo>> getBatchInfo(@RequestParam("ids") List<Long> ids);
}
